#!/usr/bin/python

from multiplylib import *


def new_fig():
    fig, ax = subplots()
    fig.set_facecolor("white")
    fig.set_dpi(72)
    fig.set_size_inches(16.0, 5.0)
    ax.set_xlim(0,350)
    ax.set_ylim(0,140)
    ax.set_frame_on(False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    return (fig, ax)



# init the dots grid params
dots_init(16)


dots_8x8 = gen_pp(mcand_width=8, mplier_width=8)   
dots_8x8[0][9] = (0,False)
dots_8x8[0][10] = (0,False)
dots_8x8[0][11] = (0,False)
dots_8x8[1][11] = (0,False)
dots_8x8[1][12] = (0,False)
dots_8x8[2][13] = (0,False)
dots_8x8[2][14] = (0,False)
dots_8x8[3][15] = (0,False)



fig1, ax1 = new_fig()
display_dots(ax1, dots_8x8, pos_base=(0,0))

savefig("fig.png", dpi=72)

# dots_8x8 = gen_pp(mcand_width=8, mplier_width=8)
# display_dots(ax1, dots_8x8, pos_base=(0,0), color="red") # the first row must process specially 



# show()                          # 
exit()






for i in range(3):
    fig, ax = plt.subplots()
    ax.set_xlim(0,300)                       # must set the xlim/ylim manually
    ax.set_ylim(0,300)
    dots_16 = gen_pp(mcand_width=16, mplier_width=16)
    # print_col_formula(dots_16)
    display_dots(dots_16, pos_base=(0,0), style="dot", color="red")
show()

# dots_8_L = gen_pp(mcand_width=8, mplier_width=8, prefix="L_")
# dots_8_H = gen_pp(mcand_width=8, mplier_width=8, prefix="H_", pp0_height_reduction=False) # not reduce the height, for counteract the "1"

# display_dots(dots_8_L, pos_base=gen_next_pos())
# display_dots(dots_8_H, pos_base=gen_next_pos())
